package com.woniuxy.hrp.web;

import com.woniuxy.hrp.Vo.MrecordPage;
import com.woniuxy.hrp.entity.Mrecord;
import com.woniuxy.hrp.entity.PageBean;
import com.woniuxy.hrp.service.MrecordService;
import com.woniuxy.hrp.unityhandler.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * @Author  李国杰
 * @Description //TODO 
 * @Date 10:44 2022/8/31
 * @Param 
 * @return 
 **/
@Transactional
@RestController
@RequestMapping("/api/v1/mrecord")
public class MrecordController {
    @Autowired
    private MrecordService mrecordService;
    @GetMapping("/seleMrecord")
    public ResponseEntity<List<Mrecord>> seleMrecord(@RequestBody Mrecord mrecord){
        /**
         * @Author  李国杰
         * @Description //TODO
         * @Date 10:44 2022/8/31
         * @Param [mrecord]
         * @return com.woniuxy.hrp.unityhandler.ResponseEntity<java.util.List<com.woniuxy.hrp.entity.Mrecord>>
         **/
        return new ResponseEntity<>("200","success",mrecordService.seleByCo(mrecord));
    }

    /**
     * 根据患者id获取患者的所有就诊记录
     * @param PatientId
     * @return
     */
    @GetMapping("/seleMrecordByPatientId")
    public ResponseEntity<List<Mrecord>> seleMrecordByPatientId(int PatientId){
        return new ResponseEntity<>("200","success",mrecordService.seleByPatientId(PatientId));
    }

    @GetMapping("/seleMrecordByMrecordId")
    public ResponseEntity<Mrecord> seleMrecordByMrecordId(int mrecordId){
        return new ResponseEntity<>("200","success",mrecordService.seleMrecordByMrecordId(mrecordId));
    }

    /**
     * 根据患者id获取患者的所有就诊记录，分页
     * @param mrecordPage
     * @return
     */
    @PostMapping("/seleMrecordByPatientId1")
    public ResponseEntity<PageBean<Mrecord>> seleMrecordByPatientId1(@RequestBody MrecordPage mrecordPage){
        return new ResponseEntity<>("200","success",mrecordService.seleMrecordByPatientId1(mrecordPage));
    }
}
